package cn.com.mayue.guava.eventBus;

import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;

/**
 * Created by mayue on 2017/4/6.
 */
public class TwoEventListener implements IEventListener {
    /**
     * @Subscribe 标明 监听处理方法
     * @AllowConcurrentEvents 保证线程安全
     * @param event event
     */
    @Override
    @Subscribe
    @AllowConcurrentEvents
    public void action(SystemEvent event) {
        TwoEvent subEvent = (TwoEvent) event;
        invoke(subEvent);
    }

    public void invoke(TwoEvent subEvent) {
        System.out.println(subEvent.toString());
    }
}
